package com.orhon.smartcampus.modules.schoolaffairs.nm;


import com.orhon.smartcampus.modules.schoolaffairs.entity.SchoolNews;
import com.orhon.smartcampus.modules.schoolaffairs.entity.SchoolNotice;
import com.orhon.smartcampus.modules.schoolaffairs.gqlModel.GQLSchoolNews;
import com.orhon.smartcampus.modules.schoolaffairs.gqlModel.GQLSchoolNotice;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SchoolNoticeMapper {

    SchoolNoticeMapper MAPPER = Mappers.getMapper(SchoolNoticeMapper.class);

    @Mappings({
            @Mapping(source = "id" , target = "id"),
            @Mapping(source = "title" , target = "title"),
            @Mapping(source = "content" , target = "content"),
            @Mapping(source = "createdBy" , target = "created_by"),
            @Mapping(source = "createdAt" , target = "created_at"),
            @Mapping(source = "updatedAt" , target = "updated_at"),
            @Mapping(source = "url" , target = "url"),
            @Mapping(source = "deletedAt" , target = "deleted_at"),
            @Mapping(ignore = true, target = "school"),
            @Mapping(ignore = true, target = "eclass"),
            @Mapping(ignore = true, target = "publisher"),
            @Mapping(ignore = true, target = "department"),
    })
    GQLSchoolNotice toSchoolNotice(SchoolNotice entity);

    @InheritConfiguration(name = "toSchoolNotice")
    List<GQLSchoolNotice> toSchoolNoticeList(List<SchoolNotice> schoolNotice);
}
